1. Field of the Invention
The present invention relates to pre-fetching instructions/data of a data processing apparatus.
2. Description of the Related Art
Conventionally, the processing speed of a computer has been improved by a method for improving the memory access speed by providing a cache memory between a CPU and a main storage device.
Furthermore, since the difference between memory access time and a CPU instruction execution cycle has increased, the further improvement of both a cache memory hit ratio and cache-miss latency is demanded.
For one method of solving such a problem, pre-fetch is used.
Pre-fetch is a method for predicting an instruction or data to be needed in the near future and storing the predicted instructions or data in a cache memory and the like in advance, and can reduce the hit-miss ratio of a cache. However, if unnecessary data is pre-fetched, necessary data may be removed from the cache. Therefore, there is also the probability of reducing its catch-hit ratio. In this case, how accurately the address of an instruction or data to be pre-fetched can be predicted.
Pre-fetch is largely classified into two methods: software application fetch by a pre-fetch instruction inserted by a compiler and the like, and pre-fetch prediction by hardware. For example, for pre-fetch by hardware, a method for pre-fetching a block next to a block for which a cache misses is well known.
As described earlier, in pre-fetching, address prediction is a major problem. In other words, although pre-fetch is necessary, useless pre-fetch must be suppressed.
In the method for pre-fetching a block next to a block for which a cache misses, a block is pre-fetched only when a cache misses. Therefore, if a plurality of blocks are consecutively accessed, it is clear that there is shortage in the number of blocks to be pre-fetched. There is a method for pre-fetching a series of blocks in advance in order to solve this problem. However, in this case, since the size of data to be pre-fetched increases, there is great loss if a prediction fails.
If even when a series of addresses are accessed, there are a series of accesses to different data areas where data is transferred between a plurality of data areas, it is difficult to predict an address simply using the order of request addresses.